<template>
	<view class="content">
		<view class="container">
			<view class="item" v-for="(item,index) in  withdrawList" :key="index">
				<view class="left">
					<view class="result">{{item.WithdrawStatusText}}</view>
					<view class="time">{{item.CreateTime}}</view>
				</view>
				<view class="right">
					<text class="fee">-{{item.WithdrawAmount}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { isLogin,toLogin } from '@/config/common.js'
	import {getAppCustomerWithdrawList} from '@/constant/schedule.js'
	export default {
		data() {
			return {
				withdrawList:[],
				query_filter: {
					servePlayerId:uni.getStorageSync('customerId'),
					pageIndex: 0,
					pageSize: 10,
				},
			};
		},
		onLoad(option) {
			if(isLogin()){
				this.getWithdrawList(this.query_filter);
			}else{
				toLogin();
			}
		},
		methods:{
			onReachBottom() {
				this.query_filter.pageIndex++;
				this.getWithdrawList(this.query_filter)
			},
			onPullDownRefresh() {
				this.query_filter.pageIndex = 0;
				this.getWithdrawList(this.query_filter)
			},
			async getWithdrawList(){
				let res = await getAppCustomerWithdrawList(this.query_filter);
				uni.stopPullDownRefresh()
				if (this.query_filter.pageIndex > 0) {
					for (let i = 0; i < res.Source.length; i++) {
						let obj = res.Source[i];
						this.withdrawList.push(obj);
					}
				} else {
					this.withdrawList = res.Source;
				}
			}
		}
	}
</script>

<style lang="scss">
	.content{
		background-color: $main-page-color;
		min-height: 100vh;
	}
	.item{
		background-color: #fff;
		border-top:2rpx solid #e1e3e2;
		display: flex;
		height:130rpx;
		padding:0rpx 30rpx;
		>view{
			flex:1;
		}
		.left{
			text-align: left;
			padding:30rpx 0rpx;
			>view{
				height:40rpx;
				line-height: 40rpx;
			}
			.result{
				font-size:30rpx;
			}
			.time{
				color:#b9bcb9;
				font-size:24rpx;
			}
		}
		.right{
			text-align: right;
			line-height: 130rpx;
		}
	}
</style>
